' This script demonstrates how to trim either the left and right edges of a document
' or the top and bottom edges of the document.

Dim appRef As Photoshop.Application
Dim docRef As Photoshop.Document

Private Sub TrimLeftRight_Click()

Set appRef = New Photoshop.Application
If (appRef.Documents.Count > 0) Then
    Set docRef = appRef.ActiveDocument
    docRef.Trim Type:=psTopLeftPixel, Top:=False, Left:=True, Bottom:=False, Right:=True
End If

End Sub


Private Sub TrimTopBottom_Click()

Set appRef = New Photoshop.Application
If (appRef.Documents.Count > 0) Then
    Set docRef = appRef.ActiveDocument
    docRef.Trim Type:=psTopLeftPixel, Top:=True, Left:=False, Bottom:=True, Right:=False
End If

End Sub
